# -*- coding:utf-8 -*-

# num1 = 1
# num2 = 1
# count = 0
#
# while True:
#     count += 1
#     if count <= 2:
#         print(num1, end=', ')
#     elif count & 1:
#         num1 += num2
#         if num1 >= 100:
#             break
#         print(num1, end=', ')
#     elif not count & 1:
#         num2 += num1
#         if num2 >= 100:
#             break
#         print(num2, end=', ')


# 结果是对的，尝试着改成函数，并将最终的结果返回。


def fibonacci(number):
    a = 0
    b = 1
    fib = [1]
    while True:
        c = a + b

        if c >= number:
            break
        fib.append(c)
        a = b
        b = c
    return fib


x = fibonacci(100)

print(x)
